<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>测试图表demo</title>
    <!--  1.引入echarts.js文件-->
    <script src="js/echarts.js"></script>
</head>
<body>
<!--2.圈一块地来显示图表,(可以设置图表的长宽)-->
<div id="main" style="width: 600px;height: 400px"></div>
</body>
</html>
<script>
    // 3.初始化echarts实例
    var myChart = echarts.init(document.getElementById('main'))
    // 4.填充数据
    var option = {
        title: {
            text: 'ECharts 入门示例'
        },
        tooltip: {},
        legend: {
            data: ['销量']
        },
        xAxis: {
            data: ['衬衫', '羊毛衫', '雪纺衫', '裤子', '高跟鞋', '袜子']
        },
        yAxis: {},
        series: [
            {
                name: '销量',
                type: 'bar',
                data: [5, 20, 36, 10, 10, 20]
            }
        ]
    };
    // 5.渲染到图表中
    myChart.setOption(option)
</script>